package com.ruixin.mvc.config;

import com.ruixin.base.exception.BaseException;
import com.ruixin.base.util.TypeConvertor;
import com.ruixin.config.BeanConstant;
import com.ruixin.config.Environment;

/**
 * 环境继承类
 */
public class EnvironmentWrapper extends Environment {

    public EnvironmentWrapper(String configFile) throws BaseException {
        super(configFile);
    }

    public EnvironmentWrapper(String configFile, String packages) throws BaseException {
        super(configFile, packages);
    }

    public String getHost(){
        return this.getProperty(BeanConstant.KEY_MVC_HOST,BeanConstant.DEFAULT_HOST);
    }

    public int getPort(){
        return TypeConvertor.toInteger(this.getProperty(BeanConstant.KEY_MVC_PORT,BeanConstant.DEFAULT_PORT));
    }

    public String contextPath(){
        return this.getProperty(BeanConstant.KEY_MVC_CONTEXTPATH);
    }

    public String getServerName(){
        return this.getProperty(BeanConstant.KEY_MVC_SERVER_NAME);
    }

    public String getStaticPathPattern(){
        return this.getProperty(BeanConstant.KEY_MVC_STATICPATHPATTERN);
    }

    public String getViewPrefix(){
        return this.getProperty(BeanConstant.KEY_MVC_VIEW_PREFIX);
    }

    public String getViewSubfix(){
        return this.getProperty(BeanConstant.KEY_MVC_VIEW_SUBFIX);
    }
}
